namespace Xliff.Ui.Domain
{
    public class TranslationUnit : EntityBase
    {
        private bool _isTranslated;
        private string _target;

        public TranslationUnit(int id, bool isTranslated, string source, string target)
        {
            Id = id;
            Source = source;
            _isTranslated = isTranslated;
            _target = target;
        }


        public int Id { get; set; }

        public string Source { get; set; }

        public string Target
        {
            get { return _target; }
            set
            {
                _target = value;
                NotifyPropertyChanged("Target");
                IsTranslated = true;
            }
        }

        public bool IsTranslated
        {
            get { return _isTranslated; }
            set
            {
                _isTranslated = value;
                NotifyPropertyChanged("IsTranslated");
            }
        }

        public static TranslationUnit Create(int id, bool isTranslated, string source, string target)
        {
            return new TranslationUnit(id, isTranslated, source, target);
        }
    }
}